如何使用XAML作为用户颜色主题的图像

aij0ehis  于 2023-08-01  发布在  其他
关注(0)|答案(1)|浏览(104)

我有一个.svg格式的图像,我将其转换为.xaml格式,我想用它作为图像源,因为我知道这是可能的。但我有另一个问题,在我的应用程序将是近10个用户的颜色主题(蓝色,红色,黄色等),当用户改变颜色主题,对我的图像颜色(刷)必须改变太(与重载或不),但我不知道如何做到这一点。也许它可以用DynamicResources或Binding或.NET MAUI ContentView来实现。转换后的xaml图像如下。我会感谢每一个答案。

<DrawingImage x:Key="DelayedDrawingImage">
  <DrawingImage.Drawing>
    <DrawingGroup ClipGeometry="M0,0 V164 H208 V0 H0 Z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="115.663,25.7727" EndPoint="107.361,133.899" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFFFE1A0" Offset="0" />
            <GradientStop Color="#FF62472F" Offset="0.770833" />
            <GradientStop Color="#FF432818" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M87.6792,123.417L36.1196,123.417C35.8092,123.417 35.5027,123.348 35.222,123.216 34.9413,123.083 34.6934,122.89 34.4959,122.651 34.2985,122.411 34.1565,122.131 34.08,121.83 34.0035,121.529 33.9945,121.214 34.0536,120.909L48.2692,47.5536C48.3622,47.0734 48.6193,46.6407 48.9962,46.3295 49.3732,46.0183 49.8466,45.8482 50.3352,45.8482L101.895,45.8482C102.205,45.8482 102.512,45.9169 102.792,46.0494 103.073,46.1818 103.321,46.3748 103.518,46.6145 103.716,46.8541 103.858,47.1345 103.934,47.4356 104.011,47.7367 104.02,48.0509 103.961,48.3559L89.7452,121.712C89.6521,122.192 89.3951,122.625 89.0181,122.936 88.6412,123.247 88.1678,123.417 87.6792,123.417z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="69.0072,45.8482" EndPoint="69.0072,123.417" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB47815" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FF432818" Geometry="F1 M208,164z M0,0z M95.3555,47.5815L82.7926,109.983 51.6221,109.983 95.3555,47.5815z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M81.2938,84.5586C90.4243,70.3423,93.3326,56.8942,95.585,47.5815L54.9011,47.5815C51.7323,60.7023 46.3939,73.2003 39.1068,84.5586 33.033,94.01 25.6721,102.567 17.2368,109.983L59.4238,109.983C67.8592,102.567,75.2201,94.01,81.2938,84.5586z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="56.4109,47.5815" EndPoint="56.4109,109.983" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFEA971D" Offset="0" />
            <GradientStop Color="#FFE6941C" Offset="0.541667" />
            <GradientStop Color="#FFCB8518" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FF432818" Geometry="F1 M208,164z M0,0z M83.0389,50.4344L67.136,50.4344C66.728,50.4344,66.4211,50.1848,66.4988,49.9161L68.1918,43.7812C68.2492,43.6642 68.3411,43.5677 68.4551,43.5047 68.569,43.4417 68.6995,43.4151 68.829,43.4287L84.7319,43.4287C85.14,43.4287,85.4468,43.6783,85.3691,43.947L83.6762,50.0819C83.6187,50.1989 83.5268,50.2954 83.4129,50.3584 83.2989,50.4214 83.1684,50.448 83.0389,50.4344z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M58.4458,57.1857L80.6333,56.7523">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M83.3882,56.802L88.4762,56.7027">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M56.7181,62.5875L78.9053,62.1541">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M81.6602,62.2037L86.7485,62.1044">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M53.992,67.9735L76.1792,67.5405">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M78.9341,67.5901L84.0224,67.4905">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M51.4714,73.4095L73.6589,72.9762">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M76.4138,73.0258L81.5021,72.9265">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M48.3005,78.7825L70.4877,78.3491">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M73.2426,78.3987L78.3309,78.2994">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M44.3789,84.205L66.5661,83.7717">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M69.321,83.8216L74.4093,83.722">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M40.4573,89.6776L62.6445,89.2442">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M65.3994,89.2938L70.4877,89.1945">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M35.6925,95.1994L57.88,94.7661">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M60.6349,94.816L65.7229,94.7164">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M31.7709,100.771L53.9584,100.338">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M56.7133,100.388L61.8016,100.288">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M25.4419,106.393L47.6294,105.959">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M50.3843,106.009L55.4723,105.91">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF432818" Thickness="3" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M93.8382,59.3902L144.238,59.3902 144.238,123.417 95.1182,123.417C94.7787,123.417 94.4532,123.282 94.2131,123.042 93.9731,122.802 93.8382,122.476 93.8382,122.136L93.8382,59.3902z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="119.038,59.3902" EndPoint="119.038,123.417" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFEA971D" Offset="0" />
            <GradientStop Color="#FFB47815" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M144.238,59.3902L170.61,59.3902 170.61,122.136C170.61,122.476 170.475,122.802 170.235,123.042 169.995,123.282 169.669,123.417 169.33,123.417L144.238,123.417 144.238,59.3902z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="157.424,59.3902" EndPoint="157.424,123.417" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFD68B1D" Offset="0" />
            <GradientStop Color="#FFA66E13" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M135.48,82.6464L126.37,82.6464C126.017,82.6464,125.73,82.9332,125.73,83.287L125.73,88.3614C125.73,88.7152,126.017,89.002,126.37,89.002L135.48,89.002C135.834,89.002,136.12,88.7152,136.12,88.3614L136.12,83.287C136.12,82.9332,135.834,82.6464,135.48,82.6464z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="125.73,85.8242" EndPoint="136.12,85.8242" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M103.596,72.8961L94.4855,72.8961C94.132,72.8961,93.8455,73.1829,93.8455,73.5367L93.8455,78.6111C93.8455,78.9649,94.132,79.2517,94.4855,79.2517L103.596,79.2517C103.949,79.2517,104.236,78.9649,104.236,78.6111L104.236,73.5367C104.236,73.1829,103.949,72.8961,103.596,72.8961z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="93.8456,76.0739" EndPoint="104.236,76.0739" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M109.866,106.047L100.756,106.047C100.402,106.047,100.116,106.334,100.116,106.688L100.116,111.762C100.116,112.116,100.402,112.403,100.756,112.403L109.866,112.403C110.219,112.403,110.506,112.116,110.506,111.762L110.506,106.688C110.506,106.334,110.219,106.047,109.866,106.047z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="100.116,109.225" EndPoint="110.506,109.225" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M156.693,108.833L147.583,108.833C147.23,108.833,146.943,109.12,146.943,109.474L146.943,114.548C146.943,114.902,147.23,115.189,147.583,115.189L156.693,115.189C157.047,115.189,157.333,114.902,157.333,114.548L157.333,109.474C157.333,109.12,157.047,108.833,156.693,108.833z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="146.943,112.011" EndPoint="157.333,112.011" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M169.97,83.6989L160.86,83.6989C160.506,83.6989,160.22,83.9858,160.22,84.3396L160.22,89.414C160.22,89.7678,160.506,90.0546,160.86,90.0546L169.97,90.0546C170.323,90.0546,170.61,89.7678,170.61,89.414L170.61,84.3396C170.61,83.9858,170.323,83.6989,169.97,83.6989z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="160.22,86.8767" EndPoint="170.61,86.8767" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M159.433,76.0741L182.842,76.0741C183.074,76.0741 183.302,76.0065 183.497,75.8797 183.692,75.7529 183.846,75.5722 183.941,75.3595 184.035,75.1468 184.066,74.9112 184.029,74.6813 183.993,74.4514 183.891,74.237 183.735,74.0641L170.514,59.3902 143.913,59.3902 158.539,75.6751C158.651,75.8006 158.789,75.9011 158.943,75.9698 159.097,76.0385 159.264,76.0741 159.433,76.0741z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="163.979,59.3902" EndPoint="163.979,76.0741" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFC8811A" Offset="0" />
            <GradientStop Color="#FF9A6309" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M144.238,59.3902L93.8382,59.3902 82.3172,74.1285C82.1783,74.3062 82.0921,74.5194 82.0684,74.7438 82.0447,74.9682 82.0845,75.1948 82.1833,75.3976 82.282,75.6004 82.4357,75.7714 82.6269,75.891 82.818,76.0106 83.0389,76.0741 83.2643,76.0741L130.61,76.0741C130.792,76.0741 130.973,76.0325 131.137,75.9524 131.301,75.8724 131.445,75.756 131.557,75.6121L144.238,59.3902z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="113.15,59.3902" EndPoint="113.15,76.0741" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFC58019" Offset="0" />
            <GradientStop Color="#FF935E07" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
       <GeometryDrawing Brush="#FFDBE8EC" Geometry="F1 M208,164z M0,0z M121.847,107.142C120.527,106.005 118.955,105.202 117.261,104.798 117.024,104.745 116.811,104.614 116.658,104.425 116.504,104.236 116.419,104.001 116.416,103.757L116.416,103.596C116.419,103.352 116.504,103.117 116.658,102.928 116.811,102.74 117.024,102.608 117.261,102.555 118.954,102.154 120.527,101.352 121.847,100.218 125.955,96.6432 125.958,90.8407 121.847,87.2651L106.973,87.2651C102.862,90.8407 102.862,96.6399 106.973,100.215 108.293,101.348 109.864,102.15 111.555,102.555 111.793,102.607 112.006,102.739 112.16,102.928 112.313,103.117 112.398,103.352 112.401,103.596L112.401,103.757C112.398,104.001 112.313,104.236 112.16,104.425 112.006,104.614 111.793,104.746 111.555,104.798 109.863,105.199 108.291,106 106.973,107.135 102.862,110.713 102.862,116.516 106.97,120.091L121.847,120.091C125.958,116.516,125.955,110.717,121.847,107.142L121.847,107.142z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M115.54,106.589L115.54,103.567C115.544,103.114 115.7,102.676 115.983,102.323 116.266,101.97 116.66,101.723 117.1,101.621 118.681,101.245 120.149,100.497 121.382,99.4385 122.252,98.7184 122.955,97.8176 123.442,96.7985 123.93,95.7794 124.19,94.6665 124.205,93.5367 124.203,93.2154 124.18,92.8944 124.137,92.576 122.506,91.7816 120.139,91.0443 112.934,92.1854 108.161,92.9384 105.991,92.0009 105.016,91.1477 104.75,91.9149 104.613,92.7212 104.612,93.5334 104.628,94.6635 104.888,95.7766 105.376,96.7958 105.864,97.815 106.568,98.7158 107.438,99.436 108.672,100.494 110.14,101.243 111.72,101.621 112.159,101.723 112.552,101.97 112.834,102.323 113.116,102.675 113.272,103.112 113.277,103.564L113.277,106.589C113.277,108.064 112.807,109.501 111.936,110.692 111.065,111.882 109.838,112.764 108.433,113.209L104.648,114.408C104.838,116.344,105.744,118.138,107.186,119.441L121.63,119.441C123.073,118.138,123.978,116.344,124.169,114.408L120.385,113.209C118.979,112.764 117.752,111.882 116.881,110.692 116.01,109.502 115.54,108.064 115.54,106.589z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="114.408,91.1477" EndPoint="114.408,119.441" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FF7A643F" Offset="0" />
            <GradientStop Color="#FF423622" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>  
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M107.22,42.124L116.922,42.124">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF6A6806" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M107.22,44.9232L116.922,44.9232">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFCEC228" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M107.22,47.7224L116.922,47.7224">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFB2AE18" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M179.928,92.4002L189.631,92.4002">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFCEC228" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M179.928,95.1994L189.631,95.1994">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFF2D265" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M179.928,97.9986L189.631,97.9986">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF6A6806" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M26.9197,73.2747L36.6224,73.2747">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFCEC228" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M26.9197,76.0739L36.6224,76.0739">
        <GeometryDrawing.Pen>
          <Pen Brush="#FF6A6806" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M26.9197,78.8734L36.6224,78.8734">
        <GeometryDrawing.Pen>
          <Pen Brush="#FFB2AE18" Thickness="3" StartLineCap="Round" EndLineCap="Round" LineJoin="Miter" MiterLimit="10" />
        </GeometryDrawing.Pen>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M23.8362,125.23C23.3342,127.909 25.1008,130.488 27.782,130.99 30.4632,131.492 33.0436,129.728 33.5456,127.05 34.0475,124.371 32.2809,121.792 29.5998,121.29 26.9186,120.788 24.3381,122.552 23.8362,125.23z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="29.5998,121.29" EndPoint="27.782,130.99" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M18.6531,128.006C20.0726,128.006 21.2234,126.854 21.2234,125.433 21.2234,124.012 20.0726,122.86 18.6531,122.86 17.2336,122.86 16.0829,124.012 16.0829,125.433 16.0829,126.854 17.2336,128.006 18.6531,128.006z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="16.0829,125.433" EndPoint="21.2235,125.433" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FF956007" Offset="0" />
            <GradientStop Color="#FFAA7306" Offset="0.20833300000000002" />
            <GradientStop Color="#FFBE8506" Offset="0.416667" />
            <GradientStop Color="#FFD19605" Offset="0.604167" />
            <GradientStop Color="#FFE8AB05" Offset="0.833333" />
            <GradientStop Color="#FFF9BA04" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FF684204" Geometry="F1 M208,164z M0,0z M18.4483,117.86C19.2671,117.86 19.9309,117.196 19.9309,116.376 19.9309,115.556 19.2671,114.892 18.4483,114.892 17.6295,114.892 16.9658,115.556 16.9658,116.376 16.9658,117.196 17.6295,117.86 18.4483,117.86z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M26.6176,118.619C28.5805,118.619 30.1718,117.026 30.1718,115.061 30.1718,113.097 28.5805,111.504 26.6176,111.504 24.6546,111.504 23.0634,113.097 23.0634,115.061 23.0634,117.026 24.6546,118.619 26.6176,118.619z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="26.6176,111.504" EndPoint="26.6176,118.619" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFF7A622" Offset="0" />
            <GradientStop Color="#FF935E07" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M36.3171,43.6435C39.0423,43.6435 41.2515,41.4322 41.2515,38.7043 41.2515,35.9765 39.0423,33.7651 36.3171,33.7651 33.5919,33.7651 31.3827,35.9765 31.3827,38.7043 31.3827,41.4322 33.5919,43.6435 36.3171,43.6435z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="31.3828,38.7043" EndPoint="41.2515,38.7043" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFB2AE18" Offset="0" />
            <GradientStop Color="#FF6A6806" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M36.5174,31.2068C37.9369,31.2068 39.0877,30.0549 39.0877,28.634 39.0877,27.2131 37.9369,26.0613 36.5174,26.0613 35.0979,26.0613 33.9472,27.2131 33.9472,28.634 33.9472,30.0549 35.0979,31.2068 36.5174,31.2068z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="36.5174,26.0613" EndPoint="36.5174,31.2068" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFEA971D" Offset="0" />
            <GradientStop Color="#FFB47815" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FF935E07" Geometry="F1 M208,164z M0,0z M53.6365,32.3641C54.8651,32.3641 55.8611,31.3671 55.8611,30.1372 55.8611,28.9074 54.8651,27.9104 53.6365,27.9104 52.4078,27.9104 51.4118,28.9074 51.4118,30.1372 51.4118,31.3671 52.4078,32.3641 53.6365,32.3641z" />
      <GeometryDrawing Brush="#FFFBBC04" Geometry="F1 M208,164z M0,0z M45.5437,29.4575C46.3625,29.4575 47.0262,28.7931 47.0262,27.9735 47.0262,27.1539 46.3625,26.4895 45.5437,26.4895 44.7249,26.4895 44.0611,27.1539 44.0611,27.9735 44.0611,28.7931 44.7249,29.4575 45.5437,29.4575z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M47.2665,39.6316C49.2295,39.6316 50.8208,38.0388 50.8208,36.0739 50.8208,34.109 49.2295,32.5162 47.2665,32.5162 45.3036,32.5162 43.7123,34.109 43.7123,36.0739 43.7123,38.0388 45.3036,39.6316 47.2665,39.6316z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="47.2666,32.5162" EndPoint="47.2666,39.6316" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FF7A643F" Offset="0" />
            <GradientStop Color="#FF423622" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M137.179,56.7017C139.904,56.7017 142.113,54.4904 142.113,51.7625 142.113,49.0346 139.904,46.8233 137.179,46.8233 134.453,46.8233 132.244,49.0346 132.244,51.7625 132.244,54.4904 134.453,56.7017 137.179,56.7017z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="137.179,46.8233" EndPoint="137.179,56.7017" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFEA971D" Offset="0" />
            <GradientStop Color="#FFB47815" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FFB47815" Geometry="F1 M208,164z M0,0z M140.325,43.5753C141.745,43.5753 142.895,42.4234 142.895,41.0026 142.895,39.5817 141.745,38.4298 140.325,38.4298 138.906,38.4298 137.755,39.5817 137.755,41.0026 137.755,42.4234 138.906,43.5753 140.325,43.5753z" />
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M148.382,49.0655C149.201,49.0655 149.865,48.4011 149.865,47.5815 149.865,46.7619 149.201,46.0975 148.382,46.0975 147.563,46.0975 146.9,46.7619 146.9,47.5815 146.9,48.4011 147.563,49.0655 148.382,49.0655z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="148.382,46.0975" EndPoint="148.382,49.0655" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FF7A643F" Offset="0" />
            <GradientStop Color="#FF423622" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M149.426,53.303C148.914,55.198 150.036,57.1497 151.933,57.6623 153.83,58.1749 155.783,57.0542 156.295,55.1593 156.807,53.2643 155.684,51.3126 153.787,50.8 151.891,50.2874 149.938,51.408 149.426,53.303z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="156.295,55.1593" EndPoint="149.426,53.303" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFEA971D" Offset="0" />
            <GradientStop Color="#FFB47815" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M178.207,131.475C180.932,131.475 183.141,129.264 183.141,126.536 183.141,123.808 180.932,121.597 178.207,121.597 175.482,121.597 173.273,123.808 173.273,126.536 173.273,129.264 175.482,131.475 178.207,131.475z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="178.207,121.597" EndPoint="178.207,131.475" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FFF7A622" Offset="0" />
            <GradientStop Color="#FF935E07" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Geometry="F1 M208,164z M0,0z M178.207,119.26C179.026,119.26 179.69,118.596 179.69,117.776 179.69,116.957 179.026,116.292 178.207,116.292 177.388,116.292 176.724,116.957 176.724,117.776 176.724,118.596 177.388,119.26 178.207,119.26z">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="178.207,116.292" EndPoint="178.207,119.26" MappingMode="Absolute" SpreadMethod="Pad" Opacity="1">
            <GradientStop Color="#FF7A643F" Offset="0" />
            <GradientStop Color="#FF423622" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
      </GeometryDrawing>
      <GeometryDrawing Brush="#FFCEC228" Geometry="F1 M208,164z M0,0z M186.076,124.328C188.039,124.328 189.63,122.735 189.63,120.771 189.63,118.806 188.039,117.213 186.076,117.213 184.113,117.213 182.522,118.806 182.522,120.771 182.522,122.735 184.113,124.328 186.076,124.328z" />
    </DrawingGroup>
  </DrawingImage.Drawing>
</DrawingImage>

字符串

iq3niunx

iq3niunx1#

1.您不使用XAML(实际上是XML)来显示SVG。Svg文件是直接使用的,唯一需要注意的是在项目中使用“.png”来处理它们。
1.有很多方法可以改变画笔颜色(实际上是TINT)。这是其中之一:
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/icon-tint-color-behavior
一步一步做什么:
1.我们将svg文件添加到资源中。比如说“myicon.svg”。
(资源>图像>添加)
1.我们在一些图像上设置这个图标。我们不使用“myicon.svg”,我们使用myicon.png。
(We在这里阅读为什么:https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/image#load-a-local-image)
1.我们添加上面链接中描述的着色行为
我们应该有一个非常接近这个的东西:

<Image Source="myicon.png"
       HeightRequest="100"
       WidthRequest="100">
       <Image.Behaviors>
          <toolkit:IconTintColorBehavior TintColor="(ADD DESIRED COLOR HERE)"/>
       </Image.Behaviors>
</Image>

字符串

相关问题